package cn.stu.common.utils;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author HGZS
 */
@Data
@NoArgsConstructor
public class ApiData implements Serializable {
    private String msg;
    private Integer code;
    private Long count;
    private Object data;


    public ApiData(String msg, Integer code) {
        this.code = code;
        this.msg = msg;
    }

    public ApiData(String msg, Integer code, Long count) {
        this.code = code;
        this.msg = msg;
        this.count = count;
    }

    public ApiData(String msg, Integer code, Long count, Object data) {
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    public static ApiData getTrue(String msg) {
        return new ApiData(msg, 0, 1L);
    }

    public static ApiData getTrue(String msg, Object data) {
        return new ApiData(msg, 0, 1L, data);
    }


    public static ApiData getPageTrue(String msg, long count, Object data) {
        return new ApiData(msg, 0, count, data);
    }

    public static ApiData getFalse(String msg) {
        return new ApiData(msg, 1, 0L);
    }

}
